package Ep05_StackAndQueue._0239;

/**
 * @author Jimmy Zhan WORKSTATION
 * @date 2023/4/14 17:34
 * 说明：双指针滑动窗口，顶级傻逼测试用例害得我超时，可恶，多好的解法，可惜。
 */

public class Mine {
    public int[] maxSlidingWindow(int[] nums, int k) {
        int left = 0, right = k - 1;
        int[] res = new int[nums.length - k + 1];
        while (right <= nums.length - 1){
            res[left] = Integer.MIN_VALUE;
            for (int i = left; i <= right; i++) {
                if (nums[i] > res[left]){
                    res[left] = nums[i];
                }
            }
            left++;
            right++;
        }
        return res;
    }
}
